package main

import (
	"fmt"
)

// 空接口可以接收任意类型的参数
/* func main() {
	// 定义一个空接口x
	var x interface{}
	s := "Hello 沙河"
	x = s
	s = "hello 适合12"

	fmt.Printf("type:%T value:%v\n", x, x)
	i := 100

	x = i
	fmt.Printf("type:%T value:%v\n", x, x)
	b := true
	x = b
	fmt.Printf("type:%T value:%v\n", x, x)
} */

func main() {
	// 空接口作为map值
	var studentInfo = make(map[string]interface{})
	studentInfo["name"] = "沙河娜扎"
	studentInfo["age"] = 18
	studentInfo["married"] = false
	fmt.Println(studentInfo)

	aaa, ok := studentInfo["age"].(string)

	fmt.Println(aaa)
	fmt.Println(ok)
}
